#pragma once 
#include"SMAC.h"
#include"SIEU.h"
#include"SLDST.h"
// #include"SBR.h"
#include"../../execution_module/write_delay_control/write_delay_control.h"
// #include"../../instruction_module/instruction.h"
//TODO:SPU的设计参考VPU
class SPU {
public:
    SPU(memory* sm, RegisterFile* rf, WriteControlModule* wcm) : SM(sm), RF(rf), WCM(wcm) {
        SMAC1 = new SMAC(1, rf);
        SMAC2 = new SMAC(2, rf);
        SIEU_unit = new SIEU(1, rf);
        SLDST_unit = new SLDST(sm, wcm, rf);
        // SBR_unit = new SBR(rf);
    }
    ~SPU() {
        delete SMAC1;
        delete SMAC2;
        delete SIEU_unit;
        delete SLDST_unit;
        // delete SBR_unit;
    }
    void Execute_SMAC1(instruction* smac_instr);
    void Execute_SMAC2(instruction* smac_instr);
    void Execute_SIEU(instruction* sieu_instr);
    void Execute_SLDST(instruction* sldst_instr);
    void Execute_SBR(instruction* sbr_instr);

private:
    memory* SM;
    RegisterFile* RF;
    WriteControlModule* WCM;

    SMAC* SMAC1;
    SMAC* SMAC2;
    SIEU* SIEU_unit;
    SLDST* SLDST_unit;
    // SBR* SBR_unit;
};